import axios from "axios"
// export const getProduct = () => fetch('/api/data/index.json').then(body => body.json()).then(res => res.data)
//get请求的发送发送方式
export const getProduct = () => axios({
    url: "/api/data/index.json",
    //get请求传递参数
    params: {
        name: "lilei"
    },
    method: 'get',
    timeout: 1000, //请求超时
    headers: {
        'H52111': "day day up good good study"
    }
})
    .then(res => {
        console.log(res)
        return res.data.data
    })
//post请求的发送方式
axios({
    url: "/users/login",
    method: 'post',
    //post请求传参用data 

    data: {
        username: "lbw",
        password: '555'
    },
    headers: {
        // 'content-type': 'application/x-www-form-urlencoded'
    },
    timeout: 1000
})
    .then(res => {
        console.log(res)
    })
    .catch(err => {
        console.log(err)
    })

    console.log(process.env)


